package gs.wicket.app.session;

import gs.wicket.app.product.Product;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Cart implements Serializable {
	private List<Product> products = new ArrayList<Product>();
	private Address billingAddress = new Address();

	public List<Product> getProducts() {
		return products;
	}
	
	public Address getBillingAddress() {
		return billingAddress;
	}

	public double getTotal() {
		double total = 0;
		for (Product product : products) {
			total += product.getPrice();
		}
		return total;
	}

	public void add(Product product) {
		products.add(product);
	}

	public void remove(Product product) {
		products.remove(product);
	}
}